package com.hzj.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient//添加注解后，项目启动会自动注册到注册到Eureka中心
public class proivder_8001 {
    public static void main(String[] args) {
        SpringApplication.run(proivder_8001.class, args);
    }

    @Bean
    //配置Hystrix：Dashboard流监控
    public ServletRegistrationBean registrationBean() {
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registrationBean.addUrlMappings("/actuator/hystrix.stream");//配置访问监控页面的网址
        return registrationBean;
    }
}
